<template>
   <view class="uv-content">
      <uv-parse
         container-style="padding: 20px"
         :content="content"
         domain="https://6874-html-foe72-1259071903.tcb.qcloud.la/demo"
         lazy-load
         scroll-table
         selectable
         use-anchor
         :tag-style="tagStyle"
         @load="load"
         @ready="ready"
         @imgtap="imgtap"
         @linktap="linktap"
      />
   </view>
</template>

<script lang="ts" setup>
import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue';
import contentHtml from './html';

const content = ref('');
const tagStyle = ref({
   table: 'box-sizing: border-box; border-top: 1px solid #dfe2e5; border-left: 1px solid #dfe2e5;',
   th: 'border-right: 1px solid #dfe2e5; border-bottom: 1px solid #dfe2e5;',
   td: 'border-right: 1px solid #dfe2e5; border-bottom: 1px solid #dfe2e5;',
   li: 'margin: 5px 0;',
});

const load = () => {
   console.log('dom 结构加载完毕时触发');
};
const ready = () => {
   console.log('渲染完毕时触发');
};
const imgtap = () => {
   console.log('图片被点击时触发');
};
const linktap = () => {
   console.log('链接被点击时触发');
};
onLoad(() => {
   uni.$uv.sleep(200).then(() => {
      content.value = contentHtml;
   });
});
</script>

<style lang="scss" scoped></style>
